
<template>
  <div>
    <p>计数器：{{ count }}</p>
    <button @click="count++">+1</button>
  </div>
</template>

<script setup>
import { ref, watch } from "vue";
const count = ref(0);

// 监听一个响应式数据
// watch(数据, 改变后回调函数)
watch(count, () => {
  console.log("count变化了~", count.value);
});
</script>

<style lang="scss" scoped>
</style>


